| (Bitwise OR)

The Bitwise OR operator performs the Boolean OR operation on the two whole numbers given. The numbers are converted to their 32 bit binary equivelants, then evaluated. The result, given as a whole decimal number (an integer), is then returned from the operation. The OR operation follows the following rules.

• A One and a Zero, evaluated, returns a one.

• A Zero and a One, evaluated, returns a one.

• A Zero and a Zero, evaluated, returns a zero.

• A One and a One, evaluated, returns a one.

You can see that it is a fairly simple operation. The difficulty comes into play when you use the 32 bit binary representation of the decimal number. The computer does all the work for you. The explanation was given to give you an idea as to what happens when using this operator.

syntax:

numberOne | numberTwo

EXAMPLE

variableOne = 15 | 20;

document.write("The sum of the OR operation is " + variableOne);

The variableOne variable contains the Bitwise OR operator, which evaluates the OR operation on the numebrs 15 and 20. The document.write statement displays the answer of 31.